package com.joseph.test;

import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;

import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;

public class FileHandler {

	public static void main(String[] args) throws IOException {
		int count = 0;
		File file = new File("D:/meilicat_bak_03.sql");
		File back = new File("D:/meilicat_bak_04.sql");
		List <String> files = FileUtils.readLines(file);
		Iterator <String> it = files.iterator();
		while(it.hasNext()) {
			String temp = it.next();
			if (StringUtils.isNotBlank(temp) && temp.contains("INSERT INTO `log` ")) {
				it.remove();
				count++;
			}
		}
		FileUtils.writeLines(back,files);
		System.out.println("删除数据: " + count);
	}
}
